package com.novel.download.exception;

import com.novel.download.controller.DownloadController;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public Object exceptionHandler(Exception e, HttpServletRequest request, HttpServletResponse response) {
        return DownloadController.searchStr() + e.getMessage();
    }
}
